/**
* 团队模块 组件
*/
<template>
  <div>
    <div class="h-team" v-if="terminal === 'pc'">
      <article class="h-article h-hidden" :key="item.id" v-for="item in teamList">
        <aside class="h-aside fl">
          <h3>{{item.name}}</h3>
          <span>{{item.postion}}</span>
          <p>{{item.profile}}</p>
        </aside>
        <section class="h-section fr">
          <img  :src="item.imgurl" />
        </section>
      </article>
      
      <div class="h-model-title mtb50">
        <h3>团队风采</h3>
        <p>TEAM STYLE</p>
      </div>
      
      <!-- 团队 -  轮播图 -->
      <div class="h-carousel" >
        <el-carousel indicator-position="outside" height="400px" :interval="2000"  >
          <el-carousel-item :key="i" v-for="(item,i) in teamphotogrouplist">
            <img :id="'T_'+(i*3+j)"  :key="cell.id"  v-for="(cell,j) in item" :src="cell.imgurl"/>
            <!-- <img src="../../assets/img/zhi-i1.jpg"/>
            <img src="../../assets/img/zhi-i1.jpg"/> -->
          </el-carousel-item>
          <!-- <el-carousel-item>
            <img src="../../assets/img/zhi-i2.jpg"/>
            <img src="../../assets/img/zhi-i2.jpg"/>
            <img src="../../assets/img/zhi-i2.jpg"/>
          </el-carousel-item>
          <el-carousel-item>
              <img src="../../assets/img/banner3.jpg"/>
              <img src="../../assets/img/banner3.jpg"/>
          </el-carousel-item> -->
        </el-carousel>
      </div>
    </div>
    <div v-else class="h-team-ph ptl15">
      <div :key="item.id" v-for="item in teamList">
      <img  :src="item.imgurl" />
      <h3 class="h-name">{{item.name}}</h3>
      <span class="h-position">{{item.postion}}</span>
      <p>{{item.profile}}</p>
       </div>
      <div class="h-model-title mtb20">
        <h3>团队风采</h3>
        <p>TEAM STYLE</p>
      </div>
      <div :key="item.id" v-for="item in teamphotolist">
        <img :src="item.imgurl" />
        <!-- <img src="@/assets/img/zhi-i2.jpg"/>
        <img src="@/assets/img/zujin1.jpg" />
        <img src="@/assets/img/zhi-i2.jpg"/> -->
        </div>
    </div>
  </div>
</template>
<script>
//import { footerList } from '@/mock' // 团队数据
import { teamData,teamPhotoData } from '@/api'

export default {
  name: 'Team',
  props: {},
  data () {
    return {
      terminal: '', // 终端类型
      teamList:[],
      teamphotolist:[],
      teamphotogrouplist:[],
      swiperflag:false
    }
  },
  created () {
    this.terminal = localStorage.getItem('terminalm')
    this.getTeamData() // 团队数据加载
    this.getTeamPhotoData() // 团队风采数据加载
  },
  mounted () {
  
  },
  methods: {
    
    getTeamData () {
      teamData().then(res => {
        this.teamList = res
      })
    },
    getTeamPhotoData () {
      teamPhotoData().then(res => {
          this.teamphotolist = res
          var list=res;
          var arrTemp = [];
          var index = 0;
          var sectionCount = 3;
          for (var i = 0; i < list.length; i++) {
          index = parseInt(i / sectionCount);
          if (arrTemp.length <= index) {
            arrTemp.push([]);
          }
          arrTemp[index].push(list[i]);
        }
        this.teamphotogrouplist=arrTemp;
        console.log(arrTemp);
        this.swiperflag=true;
      })
    }
  }
}
</script>

<style lang="scss" scoped>
  .h-article{
    height: 400px;
    margin-bottom: 10px;
    .h-aside{
      width: 380px;
      height: 100%;
      padding: 0 30px;
      box-sizing: border-box;
      color: #fff;
      background: #e0babb;
      h3{
        margin: 60px 0 20px 0;
        font-size: 30px;
        font-weight: normal;
        text-align: right;
      }
      span{
        display: block;
        margin-bottom: 30px;
        text-align: right;
        font-size: 18px;
      }
    }
    .h-section{
      width: calc(100% - 380px);
      img{
        width: 100%;
        height: 100%;
      }
    }
  }
  .h-carousel{
    margin-top: 20px;
    .el-carousel__item{
      display: flex;
      justify-content: space-between;
    }
    img{
      width: 340px;
      height: 100%;
    }
  }
  /* 移动端 */
  .h-team-ph{
    img{
      width: 100%;
      margin: 10px 0;
    }
    .h-name, .h-position{
      text-align: center;
    }
    .h-position{
      display: block;
      margin: 10px 0 20px 0;
    }
  }
</style>
